Public Class FunctionText_Factory
    Public Sub SaveText( _
                         ByVal oFunction As SQLAutoDocLib.Function, _
                         ByVal sText As String)

        Dim oFactory As New DBFunctionText_Factory

        oFactory.ClearText(oFunction.ID, oFunction.RevID)

        Dim sBuffer As String
        Dim iPos As Integer = 0
        Dim iOrder As Integer = 0

        Do While (iPos + 8000) < sText.Length
            sBuffer = sText.Substring(iPos, 8000)
            iPos = iPos + 8001

            oFactory.AddText(oFunction.ID, oFunction.RevID, iOrder, sBuffer)
            iOrder = iOrder + 1
        Loop

        If iPos < sText.Length Then
            sBuffer = sText.Substring(iPos, sText.Length - iPos)
            oFactory.AddText(oFunction.ID, oFunction.RevID, iOrder, sBuffer)
        End If
    End Sub

    Public Function GetText( _
        ByVal lFunctionID As Long, _
        ByVal lFunctionRevID As Long) As String

        Dim oFactory As New DBFunctionText_Factory

        Return oFactory.GetText(lFunctionID, lFunctionRevID)
    End Function
End Class
